#define _CRT_SECURE_NO_WARNINGS 1.
#include "Fun.h"


void Stack:: Init()
{
		a = nullptr;
		top = capacity = 0;
}

void Stack:: Push(int x)
{
		if (top == capacity)
		{
			size_t newcapacity = capacity == 0 ? 4 : capacity * 2;
			a = (int*)realloc(a, sizeof(int) * newcapacity);
			capacity = newcapacity;
		}

		a[top++] = x;
}

int Stack :: Top()
{
		return a[top - 1];
}





